package com.joseph.test;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @description 
 * @author Joseph_Mok
 * @date 2016年4月8日上午11:42:25
 */
public class Singleton01 {

	private static final Singleton01 singleton01 = new Singleton01();
	
	private Singleton01() {
		System.out.println("我是私有构造函数！");
	}
	
	public static Singleton01 getInstance() {
		return singleton01;
	}
	
	public void say() {
		System.out.println("Hello World");
	}
	
	public static void main(String[] args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
		Constructor <Singleton01> cons =  Singleton01.class.getDeclaredConstructor();
		Singleton01 s1 = cons.newInstance();
		Singleton01 s2 = cons.newInstance();
		System.out.println(s1 == s2);
	}
}
